package com.lanchetech.dao;

import com.lanchetech.bean.request.MemberTypeReq;import com.lanchetech.bean.request.UserGroupReq;import com.lanchetech.bean.vo.IncomeVO;import com.lanchetech.bean.vo.UserGroupCommissionVO;import com.lanchetech.bean.vo.UserGroupListVO;import com.lanchetech.bean.vo.UserGroupVO;import com.lanchetech.entity.UserGroup;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface UserGroupMapper {
    int deleteByPrimaryKey(Long id);

    int insert(UserGroup record);

    int insertSelective(UserGroup record);

    UserGroup selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserGroup record);

    int updateByPrimaryKey(UserGroup record);

    int updateBatch(List<UserGroup> list);

    int updateBatchSelective(List<UserGroup> list);

    int batchInsert(@Param("list") List<UserGroup> list);

    List<UserGroup> findAllByMemberId(@Param("memberId") Long memberId);

    int updateMemberLevelByMemberIdAndMemberType(@Param("updatedMemberLevel") Integer updatedMemberLevel, @Param("memberId") Long memberId, @Param("memberType") Byte memberType);

    int updateCaptainLevelByCaptainIdAndCaptainType(@Param("updatedCaptainLevel") Integer updatedCaptainLevel, @Param("captainId") Long captainId, @Param("captainType") Byte captainType);

    List<UserGroup> findAllByMemberIdAndMemberLevel(@Param("memberId") Long memberId, @Param("memberLevel") Integer memberLevel);

    List<UserGroupVO> findAllPage(UserGroupReq req);

    UserGroup findOneByCaptainIdAndMemberId(@Param("captainId") Long captainId, @Param("memberId") Long memberId);

    List<UserGroup> findAllByCaptainId(@Param("captainId") Long captainId);

    UserGroup findOneByMemberIdAndMemberTypeAndCaptainType(@Param("memberId") Long memberId, @Param("memberType") Byte memberType, @Param("captainType") Byte captainType);

    int deleteByCaptainId(@Param("captainId") Long captainId);

    int deleteByMemberId(@Param("memberId") Long memberId);

    List<UserGroup> findAllByMemberIdAndMemberType(@Param("memberId") Long memberId, @Param("memberType") Byte memberType);

    List<UserGroupCommissionVO> getUserGroupByIdentityType(@Param("identityType") Byte identityType, @Param("id") Long id);

    UserGroupCommissionVO getUserGroupTotal(@Param("identityType") Byte identityType, @Param("id") Long id);

    UserGroupCommissionVO getCaptainGroupMemberNumber(@Param("id") Long id);

    List<UserGroupListVO> getUserGroupMemberByMemberType(MemberTypeReq req);

    UserGroup selectOneByMemberId(@Param("memberId") Long memberId);

    UserGroup findOneByMemberIdAndMemberType(@Param("memberId") Long memberId, @Param("memberType") Byte memberType);

    List<IncomeVO> getMemberAndPartnerIncome(UserGroupReq req);

    UserGroup findOneByCaptainIdAndCaptainTypeAndMemberId(@Param("captainId") Long captainId, @Param("captainType") Byte captainType, @Param("memberId") Long memberId);

    UserGroup findOneByMemberIdAndCaptainType(@Param("memberId") Long memberId, @Param("captainType") Byte captainType);

    List<UserGroup> findAll();

    int updateShareholderIdById(@Param("updatedShareholderId")Long updatedShareholderId,@Param("id")Long id);

    Long countByCaptainId(@Param("captainId")Long captainId);

    List<UserGroup> findAllByShareholderId(@Param("shareholderId")Long shareholderId);

    List<UserGroup> findAllByCaptainIdEqualShareholderId();

    int updateShareholderIdByCaptainId(@Param("updatedShareholderId")Long updatedShareholderId,@Param("captainId")Long captainId);

    UserGroup findOneByMemberId(@Param("memberId")Long memberId);



}